﻿$ExecutePath = $PWD
Set-Location $PSScriptRoot

Set-Location ..

# 判断是否下载了Node.js扩展包
if (!(Test-Path "./node_modules")) {
    Write-Host "npm i"
    npm i
}

## Scss 编译
# =================================================================================================================== #
## 生成
$scss_files = Get-ChildItem -Recurse -Include *.scss -Name
for ($i = 0; $i -lt $scss_files.Count; $i++) {
    if ($scss_files.Count -eq 1) {
        $item = $scss_files;
    } else {
        $item = $scss_files[$i]
    }
    if (!$item) {
        continue;
    }
    $item = $item -replace "\\","/"
    $name = $item -replace ".scss",".s.css"
    Write-Host "scss $item`:$name --style compact --no-cache"
    scss $item`:$name --style compact --no-cache
}

Set-Location $ExecutePath
if ($PSScriptRoot -eq $ExecutePath) {
    # timeout.exe /T -1
}
